package com.xsz.pda

import com.blankj.utilcode.util.SPUtils

object Config {

//    const val ip = "47.109.66.178"
//    const val ip = "8.137.51.169"
    const val ip = "192.168.1.5"
//    const val ip = "192.168.1.3"

    private const val PROJECT_ID = "PROJECT_ID"
    private const val PROJECT_NO = "PROJECT_NO"
    private const val OPEN_FIRST_CHECK = "OPEN_FIRST_CHECK"
    private const val CHECK_ID_CARD = "CHECK_ID_CARD"

    private const val DEVICE_NAME = "DEVICE_NAME"

    private const val GROUP_NAME = "GROUP_NAME"

    private const val GROUP_ID = "GROUP_ID"

    private const val TICKET_TYPES = "TICKET_TYPES"

    private const val PROJECT_TICKET_SIZE = "PROJECT_TICKET_SIZE"

    fun saveName(name: String){
        SPUtils.getInstance("t").put(DEVICE_NAME, name)
    }

    fun getName():String {
        return SPUtils.getInstance("t").getString(DEVICE_NAME, "")
    }

    fun saveProjectNo(projectId: String){
        SPUtils.getInstance("t").put(PROJECT_NO, projectId)
    }

    fun getProjectNo(): String {
        return SPUtils.getInstance("t").getString(PROJECT_NO, "")

    }

    fun isOpenFirstCheck(): Boolean{
        return SPUtils.getInstance("t").getBoolean(OPEN_FIRST_CHECK, false)
    }

    fun saveOpenFirstCheck(open: Boolean) {
        SPUtils.getInstance("t").put(OPEN_FIRST_CHECK, open)
    }

    fun saveCheckIDCARD(open: Boolean) {
        SPUtils.getInstance("t").put(CHECK_ID_CARD, open)
    }

    fun isCheckIDCARD(): Boolean{
        return SPUtils.getInstance("t").getBoolean(CHECK_ID_CARD, false)
    }

    fun saveGroup(projectId: String){
        SPUtils.getInstance("t").put("GROUP", projectId)
    }

    fun getGroup(): String {
        return SPUtils.getInstance("t").getString("GROUP", "")

    }
    fun saveProjectId(projectId: String){
        SPUtils.getInstance("t").put(PROJECT_ID, projectId)
    }

    fun getProjectId(): String {
        return SPUtils.getInstance("t").getString(PROJECT_ID, "")
    }

    fun getGroupId(): String {
        return SPUtils.getInstance("t").getString(GROUP_ID, "")
    }

    fun setGroupId(groupId: String?) {
        SPUtils.getInstance("t").put(GROUP_ID, groupId)
    }

    fun getGroupName(): String {
        return SPUtils.getInstance("t").getString(GROUP_NAME, "")
    }

    fun setGroupName(groupName: String?) {
        SPUtils.getInstance("t").put(GROUP_NAME, groupName)
    }

    fun setTicketTypeIds(ids: Set<String?>?) {
        SPUtils.getInstance("t").put(TICKET_TYPES, ids)
    }

    fun getTicketTypeIds(): Set<String> {
        return  SPUtils.getInstance("t").getStringSet(TICKET_TYPES, HashSet<String>())
    }

    fun getProjectTicketSize():Int {
        return SPUtils.getInstance("t").getInt(PROJECT_TICKET_SIZE, 0)
    }

    fun setProjectTicketSize(size: Int) {
        SPUtils.getInstance("t").put(PROJECT_TICKET_SIZE, size)
    }
}